from rest_framework import serializers

from apps.system.models import Permission
from conf.config import METHOD_LIST


class PermissionSerializer(serializers.ModelSerializer):
    class Meta:
        model = Permission
        fields = '__all__'

    def validate_method_types(self, value):

        if value not in METHOD_LIST:
            # raise serializers.ValidationError("请求方式错误")
            return ''

        return value
